package vip.jc.integration.dynamicwithshardingSphere.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vip.jc.integration.dynamicwithshardingSphere.dao.entity.User;
import vip.jc.integration.dynamicwithshardingSphere.service.UserService;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/user/{id}")
    public User getMultiSource(@PathVariable("id") Long id ) {
        return userService.getById(id);
    }

    @PostMapping("/user/add")
    public void addMultiSource(@RequestBody User user) {
        userService.addUser(user);
    }
}
